<?php
date_default_timezone_set('Asia/Chongqing');
require '../vendor/autoload.php';

$options=array('database_type' => 'pgsql',
    'database_name' => 'yourall',
    'port'=>5432,
    'server' => '127.0.0.1',
    'username' => 'azureuser',
    'password' => 'root');
//$db=new medoo($options);
$app=new \Slim\Slim();
$app->config(array(
    'mode'=>'development',
    'templates.path' => '../templates',
    'cookies.encrypt' => true,
    'cookies.lifetime' => '12 months',
    'cookies.httponly' => false,
    'cookies.secret_key' => 'a98[32]',
    'cookies.cipher' => MCRYPT_RIJNDAEL_256,
    'cookies.cipher_mode' => MCRYPT_MODE_CBC
));
$app->configureMode('production', function () use ($app) {
    $app->config(array(
        'log.enable' => true,
        'debug' => false
    ));
});
$app->configureMode('development', function () use ($app) {
    $app->config(array(
        'log.enable' => false,
        'debug' => true
    ));
});
$app->container->singleton('log', function () {
    $log = new \Monolog\Logger('slim-skeleton');
    $log->pushHandler(new \Monolog\Handler\StreamHandler('../logs/app.log', \Monolog\Logger::DEBUG));
    return $log;
});
$app->get('/', function () use ($app) {
    $app->log->info("Slim-Skeleton '/' route");
    $app->render('index.html',array('app'=>$app));
})->name('home');
$app->run();

